package api

import (
	"openapi.itspire.cn/common/dict"
	"openapi.itspire.cn/common/global"
	"openapi.itspire.cn/database"
	"openapi.itspire.cn/model"
	"openapi.itspire.cn/utils"
	"github.com/gin-gonic/gin"
)

func ProjectList(c *gin.Context) {
	var project []model.Project

	query := database.Ins.
		Where("delete_time = ? AND status = ?", dict.DeleteNot, dict.StatusOn).
		Order("id desc").
		Limit(global.LabelMax)
	if err := query.Find(&project).Error; err != nil {
		panic(err)
	}

	utils.Success(c, project)
}
